package View;

import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Tooltip;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.StageStyle;

import java.io.IOException;

public class SelectGroupHeadWindow extends window {
    public SelectGroupHeadWindow () throws IOException {
        root = FXMLLoader.load(getClass().getResource("/Fxml/selectGroupHead.fxml"));
        Scene scene = new Scene(root, 600, 600);
        scene.setFill(Color.TRANSPARENT);
        setScene(scene);
        initStyle(StageStyle.TRANSPARENT);
        setResizable(false);
        setTitle("We Chat");
        Image image=new Image("/Picture/sourceMaterial/选择群头像背景图.jpg",612,400,false,false);
        ((ImageView)$("backgroundImage")).setImage(image);
        move();
        quit();
        setIcon();
        minimiser();
    }


    //退出
    @Override
    public void quit() {
        ((Button) $("exitButton")).setTooltip(new Tooltip("退出"));
        ((Button) $("exitButton")).setOnAction(event -> {
            close();
        });

    }
    //最小化
    @Override
    public void minimiser() {
        ((Button) $("ministerButton")).setTooltip(new Tooltip("最小化"));
        ((Button) $("ministerButton")).setOnAction(event -> {
            setIconified(true);
        });
    }
    public void InitHead(){
        ((ImageView)$("dieImage")).setImage(new Image("/Picture/headPortrait/死神.jpg", 80, 80, false, false));
        ((ImageView)$("dieImage")).setClip(getCircle());
        ((ImageView)$("seaImage")).setImage(new Image("/Picture/headPortrait/海贼王.jpg", 80, 80, false, false));
        ((ImageView)$("seaImage")).setClip(getCircle());
        ((ImageView)$("qinImage")).setImage(new Image("/Picture/headPortrait/秦时明月.jpg", 80, 80, false, false));
        ((ImageView)$("qinImage")).setClip(getCircle());
        ((ImageView)$("superImage")).setImage(new Image("/Picture/headPortrait/超兽武装.jpg", 80, 80, false, false));
        ((ImageView)$("superImage")).setClip(getCircle());
        ((ImageView)$("bearImage")).setImage(new Image("/Picture/headPortrait/熊出没.jpg", 80, 80, false, false));
        ((ImageView)$("bearImage")).setClip(getCircle());
        ((ImageView)$("fireImage")).setImage(new Image("/Picture/headPortrait/火影忍者.jpg", 80, 80, false, false));
        ((ImageView)$("fireImage")).setClip(getCircle());
        ((ImageView)$("basImage")).setImage(new Image("/Picture/headPortrait/灌篮高手.jpg", 80, 80, false, false));
        ((ImageView)$("basImage")).setClip(getCircle());
        ((ImageView)$("avengerImage")).setImage(new Image("/Picture/headPortrait/复仇者联盟.jpg", 80, 80, false, false));
        ((ImageView)$("avengerImage")).setClip(getCircle());
        ((ImageView)$("detectiveImage")).setImage(new Image("/Picture/headPortrait/名侦探柯南.jpg", 80, 80, false, false));
        ((ImageView)$("detectiveImage")).setClip(getCircle());
        ((ImageView)$("sheepImage")).setImage(new Image("/Picture/headPortrait/喜羊羊与灰太狼.jpg", 80, 80, false, false));
        ((ImageView)$("sheepImage")).setClip(getCircle());
    }
    public Circle getCircle(){
        Circle circle = new Circle();
        circle.setRadius(40);
        circle.setCenterX(40);
        circle.setCenterY(40);
        return circle;
    }
}
